@extends('admin._layouts.default')

@section('main')

      <div class="row-fluid ">
        <div class="span12 box gradient ">
      <div class="title">
            <div class="row-fluid">
                <h3>
                {{--<a href="wechat_article_push.html"  class="btn btn-primary btn-mini pull-right" style="margin:5px 5px 0 0"><i class="fa fa-paper-plane-o"></i> 群发</a>--}}
                 <a href="{{ route('admin.accounts.materials_create') }}"  class="btn btn-info btn-mini pull-right" style="margin:5px 5px 0 0"><i class="fa fa-edit"></i> 新增</a>
                  <i class="fa  fa-share-alt"></i> 图文信息管理
                </h3>
            </div>
        </div><!-- End .title -->
        <div class="content min_h500">

            <table id="datatable_in" class="responsive table table-striped" style="width:100%;margin-bottom:0; ">
              <thead>
               <tr>
                 <th width="80">
                   缩略图
                  </th>
                  <th width="160">
                    标题
                  </th>
                  <th>
                    摘要
                  </th>
                  {{--<th width="120">--}}
                   {{--推送目标--}}
                  {{--</th>--}}
                 <th width="160">
                   转发奖励
                 </th>
                 <th width="160">
                   操作
                 </th>
               </tr>
              </thead>
              <tbody>
              @foreach($materials as $material)
               <tr>
                  <td>
                   <img class="thumbnail small" src="{{ $PATH }}{{ $material->cover }}">
                  </td>
                 <td>
                    {{ $material->title }}
                  </td>
                  <td>
                    <i class="fa fa-quote-left"></i> {{ $material->dec }}
                 </td>
                 {{--<td>--}}
                    {{--<i class="fa fa-home"></i> 公司动态<br/>--}}
                 {{--</td>--}}
                 <td>
                    @if($material->points == 0)
                    不转发
                    @elseif($material->type == 1)
                    分享 {{ $material->points }}
                    @elseif($material->type == 2)
                    点击 {{ $material->points }}
                    @endif
                 </td>
                 <td>
                    <div class="btn-group1">
                      <a href="{{ route('admin.accounts.materials_edit',array('id'=>$material->id)) }}" class="btn btn-small" rel="tooltip" data-placement="left" data-original-title="编辑文章"><i class="gicon-edit"></i></a>
                      {{--<a class="btn btn-small" rel="tooltip" data-placement="left" data-original-title="取消审核"><i class="gicon-pause"></i></a>--}}
                     <a class="btn btn-inverse btn-small" onclick="set_delete('{{ $material->id }}');" rel="tooltip" data-placement="bottom" data-original-title="删除文章" data-toggle="modal" data-target="#confirm_alert"><i class="gicon-remove icon-white"></i></a>
                   </div>
                 </td>
               </tr>
               @endforeach

               </tbody>
            </table>
                <div class="row-fluid control-group">

                    <div class="pagination pull-right ">
                      {{ $materials->link() }}
                    </div>
                </div>
                <br/>


            </div>
        </div>
        <!-- End box -->
      </div>


@stop


@section('modals')

<div id="confirm_alert" class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-sm">
  <form action="{{ route('admin.accounts.materials_deleteit') }}" id="form_delete" method="post">
      <input type="hidden" name="delete_id" id="delete_id" value="">
    <div class="modal-content">
      <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 class="modal-title" id="myModalLabel">确定本次操作吗？</h3>
      </div>
      <div class="modal-body">
        <i class=" icon-warning-sign color_red pull-left fs_24"></i>

        <p>一旦【确定】，本次操作不可撤销。</p>

      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
        <button type="submit" class="btn btn-primary">确定</button>
      </div>
    </div>
    </form>
  </div>
</div>
@stop


@section('script')
<script language="javascript" type="text/javascript" src="{{ URL::asset('ad/js/plugins/full-calendar/fullcalendar.min.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('ad/js/plugins/jquery.peity.min.js') }}"></script>
<script type="text/javascript" language="javascript" src="{{ URL::asset('ad/js/plugins/datatables/js/jquery.dataTables.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('ad/js/plugins/chosen/chosen/chosen.jquery.min.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('ad/js/plugins/flot/jquery.flot.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('ad/js/plugins/jquery.uniform.min.js') }}"></script>
<script src="{{ URL::asset('ad/js/plugins/justGage.1.0.1/resources/js/raphael.2.1.0.min.js') }}"></script>
<script src="{{ URL::asset('ad/js/plugins/justGage.1.0.1/resources/js/justgage.1.0.1.min.js') }}"></script>
<script src="{{ URL::asset('ad/js/scripts.js') }}"></script>


    <script type="text/javascript" charset="utf-8">
    // Datatables
    $(document).ready(function() {
      var dontSort = [];
                $('#datatable_city thead th').each( function () {
                    if ( $(this).hasClass( 'no_sort' )) {
                        dontSort.push( { "bSortable": false } );
                    } else {
                        dontSort.push( null );
                    }
      } );
      $('#datatable_city').dataTable( {
        "sDom": "<'row table_top_bar'<'row-fluid'>'<'to_hide_phone'>'f'<'>r>t<'row'>",
         "sDom": "<'row table_top_bar'<'row-fluid'<'to_hide_phone' f>>><'row'>",
         "aaSorting": [[ 1, "asc" ]],
        "bPaginate": false,
        "bJQueryUI": false,
        "aoColumns": dontSort

      } );
      $.extend( $.fn.dataTableExt.oStdClasses, {
        "s`": "dataTables_wrapper form-inline"
      } );
    } );
    </script>
    <script>
    function set_delete(id){
        $('#delete_id').val(id);
    }
    function delete_it(){
        $('#form_delete').submit();
    }
    </script>
@stop
